<?php

	if(!array_key_exists("status_update", $_POST)){
		header("Location: index.php");
	}
	session_start();
	//User has credentials to validate
	$conn = mysql_connect("", "piedu_user", "q&&^%@8ezO8+");
	mysql_select_db("piedu_db");
	$sql = "INSERT INTO community (username, message, to_user) values ('{$_SESSION['username']}', '{$_POST['status_update']}', '{$_POST['status_to']}')";
	mysql_query($sql, $conn);
	header("Location: main.php?username={$_POST['status_to']}");
	exit;

?>